/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ActionForm;


import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author cpn02
 */
public class LoginForm extends ActionForm {
    private String userName;
    private String passw;

    public String getPassw() {
        return passw;
    }

    public void setPassw(String passw) {
        this.passw = passw;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
    
    @Override
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors =  new ActionErrors();
        if(userName==null ||userName.trim()=="" )
            errors.add("userName",new ActionMessage("errors.null"));
        if(passw==null || passw.trim()=="" )
            errors.add("passw",new ActionMessage("errors.null"));
        return errors;
    }

}
